package com.boc.ibatis.config;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class JndiDataSource {
	public static final DataSource ds;
	static {
		try {
			Context context = new InitialContext();
			ds = (DataSource)context.lookup("java:comp/env/jdbc/mysql");
		} catch (NamingException e) {
			e.printStackTrace();
			throw new RuntimeException("获取JNDI数据库失败!",e);
		}
		
	}
}
